package com.sys.basics.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sys.basics.entity.SysAttachment;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.List;


/**
 * @author: ares
 * @date: 2021-10-08
 * @description: 附件资源表 服务类
 */
public interface SysAttachmentService extends IService<SysAttachment> {

    String uploadSingle(Long parentId, MultipartFile file) throws IOException;

    List<String> uploadMultipart(Long parentId, MultipartFile[] files) throws IOException;

    IPage<SysAttachment> getPages(Page<SysAttachment> page, SysAttachment attachment);

    SysAttachment getTreeById(Long id);

    List<SysAttachment> getChildrenByParentId(Long parentId);

    List<SysAttachment> getChildrenTreeByParentId(Long parentId);

    List<SysAttachment> getDirectoryTreeByParentId(Long parentId);

    SysAttachment getTreeByIdAsLeaf(Long id);

    boolean removeSelfAndChildrenById(Long id);

    boolean createDirectory(Long parentId, String name);

    boolean reNameDirectory(Long id, String name);

    boolean batchMove(Long id, List<Long> attachmentIds);

    boolean batchRemove(List<Long> attachmentIds);

    SysAttachment getDirectoryByName(Long parentId, String name);

}
